function createCalender(){
var calenderStore=CRM.commons.createStore('calenderStore',CRM.SPComp.salesCalenderArray,'salesCalender/fillCalenderGrid');
var saleCalenderGrid=CRM.commons.createGrid('saleCalenderType',calenderStore,CRM.SPComp.calenderCalModel());

var salesCalenderTypesStore= CRM.commons.createComboStore('salesCalenderTypesStore','salesCalender/fillCalenderDropDown','type');
var salesAssignToStore= CRM.commons.createComboStore('searchCriteriaid','salesCalender/fillCalenderDropDown');


var calenderHeader={
		xtype:'fieldset',
		id:'calenderHeader',
		height:60,
		items:[
		       {
		    	   xtype:'compositefield',
		    	   items:[
		    	          	{xtype:'displayfield',html:'Assign To'},
					       	{
		    	          		xtype:'combo',
		    	          		id:'salesCalenderAssignto',
		    	          		store		: salesAssignToStore,
	                            displayField : 'name',
	                            valueField  	: 'id',
	                            triggerAction: 'all',
	                            width		: 160,
	                            editable		: false,
	                            mode		:'local'
					       	},
					       	{xtype:'displayfield',html:'Period From'}
					       	,
					       	{xtype:'datefield',id:'periodFrom'}
					       	,
					       	{xtype:'displayfield',html:'Period To'}
					       	,
					       	{xtype    	: 'datefield',id       	: 'periodTo'}
					       	,
					       	{xtype:'displayfield',html:'Type'}
					       	,
					       	{
					       		xtype    	: 'combo',
                                id       	: 'calenderType',
                               store		: salesCalenderTypesStore,
                                displayField : 'name',
                                valueField  	: 'id',
                                
                               triggerAction: 'all',
                               width		: 160,
                               editable		: false,
                               listeners : {select : function(combo,record,index){
					       		
					       		salesAssignToStore.reload({
					       			params:{
					       					operation:'assignto',
					       					type	:record.get('id')
					       		}
					       		});
					       	}
					       	}
					       	}
					       	,
					       	{xtype:'button',text:'Search',
					       		handler:function(){
					       		var form=salesCalender.getForm();
					       		saleCalenderGrid.store.reload({
					       			params:{
					       				assignToId:form.findField('salesCalenderAssignto').getValue(),
					       				typeid:form.findField('calenderType').getValue(),
					       				pfrom:form.findField('periodFrom').getValue(),
					       				pto:form.findField('periodTo').getValue()
					       		}
					       		});
					       	}
					       	},
					       	{
					       		xtype:'button',
					       		text:'Clear Search',
					       		handler:function(){
					       		salesCalender.getForm().reset();
					       		
					       		calenderStore.removeAll();
					       	}
					       	}
					     ]
		       }
		       ]
	};

var salesCalender=new Ext.form.FormPanel({
		id:'salesCalender',
		items:[calenderHeader,saleCalenderGrid]
});
 return salesCalender;
};